package com.ctl.se;

public class FatherChildTest {
    static class Father {
        public Father() {
            System.out.println("Father()");
        }

        public void say() {
            System.out.println("F");
        }

        public int add(int i) {
            return i++;
        }
    }

    static class Child extends Father {
        public Child() {
            System.out.println("Child()");
        }

        public void say() {
            System.out.println("C");
        }
    }

    public static void main(String[] args) {
        try {
            Child child = (Child) new Father();
            child.say();
        } catch (Exception e) {
        }
        try {
            Father father = new Child();
            father.say();
            System.out.println(father.add(5));
        } catch (Exception e) {
        }
    }
}
